﻿<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html>
<html lang="en">
	<head>
	<base href="<%=basePath%>">
	<!-- jsp文件头和头部 -->
	<%@ include file="../../system/main/main_top.jsp"%> 
	</head> 
<body>
<div class="container-fluid" id="main-container">
<div id="breadcrumbs">
	<ul class="breadcrumb">
		<li><i class="icon-home"></i> <a>商户管理</a> <span class="divider">
				<i class="icon-angle-right"></i>
		</span></li>
		<li class="active">礼品列表</li>
	</ul>
	<!--.breadcrumb-->
</div>
<div id="page-content" class="clearfix">
  <div class="row-fluid">
	<div class="row-fluid">
			<!-- 检索  -->
			<form action="product/gift/list.do" method="post" name="productGiftForm" id="productGiftForm">
			<input type="hidden" name="org_id" id="org_id" value="${pageData.org_id }"/>
			<table>
				<tr>
					<td>
						<span class="input-icon">
							<input autocomplete="off" id="nav-search-input" type="text" name="product_name" value="${pageData.product_name }" placeholder="这里输入礼品名称" />
							<i id="nav-search-icon" class="icon-search"></i>
						</span>
					</td>
					<td style="vertical-align:top;"><button class="btn btn-mini btn-light" onclick="search();"><i id="nav-search-icon" class="icon-search"></i></button></td>
					<td style="vertical-align:top;"><a class="btn btn-mini btn-light" onclick="clearCondition();" title="清空查询条件"><i id="nav-search-icon"></i>清空查询条件</a></td>
				</tr>
			</table>
			<!-- 检索  -->
		
			<table id="table_report" class="table table-striped table-bordered table-hover">
				<thead>
					<tr>
						<th>序号</th>
						<th>礼品名称</th>
						<th>库存数量</th>
						<th>礼品兑换所需初吻币数</th>
						<!-- <th>礼品品牌</th> -->
						<th>应用对象</th>
						<th>奖品应用时间</th>
						<th>奖品中奖比率(百分比)</th>
						<th>奖品中奖金额</th>
						<th>礼品类型</th>
						<th>礼品状态</th>
						<th>礼品缩略图</th>
						<!-- <th>礼品标题</th>
						<th>礼品描述</th> -->
						<th class="center">操作</th>
					</tr>
				</thead>
										
				<tbody>
				<!-- 开始循环 -->	
				<c:choose>
					<c:when test="${not empty varList}">
						<c:forEach items="${varList}" var="var" varStatus="vs">
							<tr>
								<td class='center' style="width: 30px;">${vs.index+1}</td>
								<td>${var.product_name}</td>
								<td>${var.gift_store_number }</td>
								<td>${var.exchange_number }</td>
								<%-- <td>${var.brandName }</td> --%>
								<td>
									<c:if test="${var.target_object == 1}">
										APP平台
									</c:if>
									<c:if test="${var.target_object == 2}">
										橘子洲电子音乐节
									</c:if>
									<c:if test="${var.target_object == 3}">
										ALL
									</c:if>
									<c:if test="${var.target_object == 4}">
										公众号抽奖
									</c:if>
									<c:if test="${var.target_object == 5}">
										人气票选抽奖
									</c:if>
								</td>
								<td>
									<c:if test="${var.target_date_type == 1}">
										全部
									</c:if>
									<c:if test="${var.target_date_type == 2}">
										周末
									</c:if>
									<c:if test="${var.target_date_type == 3}">
										非周末
									</c:if>
								</td>
								<td>${var.rate }</td>
								<td>${var.lottery_amount }</td>
								<td>
									<c:if test="${var.gift_type == 1}">
										实物礼物
									</c:if>
									<c:if test="${var.gift_type == 2}">
										虚拟礼物
									</c:if>
									<c:if test="${var.gift_type == 3}">
										虚拟赠送礼物
									</c:if>
									<c:if test="${var.gift_type == 4}">
										实物奖品
									</c:if>
									<c:if test="${var.gift_type == 5}">
										虚拟奖品
									</c:if>
									<c:if test="${var.gift_type == 6}">
										微信红包
									</c:if>
									<c:if test="${var.gift_type == 7}">
										APP现金红包
									</c:if>
								</td>
								<td>
									<c:if test="${var.is_on_sale == '2' }"><span class="label label-important arrowed-in">下架</span></c:if>
									<c:if test="${var.is_on_sale == '1' }"><span class="label label-success arrowed">已上架</span></c:if>
								</td>
								<td>
									<c:if test="${var.img_thumb != '' && var.img_thumb != null }">
										<a href="<%=basePath%>${var.img_thumb}" target="_blank"><img src="<%=basePath%>${var.img_thumb}" width="50"/></a>
									</c:if>
								</td>
								<%-- <td>${fn:substring(var.remark,0,20)} ...</td>
								<td>${fn:substring(var.description,0,20)} ...</td> --%>
								<td style="width: 60px;" class="center">
									<div class='hidden-phone visible-desktop btn-group'>
										<a class='btn btn-mini btn-info' title="查看" onclick="view('${var.gift_id }');"><i class='icon-eye-open'></i></a>
										<c:if test="${var.target_object == 1}">
											<a class='btn btn-mini btn-info' title="查看兑换记录" onclick="viewExchange('${var.gift_id }');">查看兑换记录</a>
										</c:if>
										<a class='btn btn-mini btn-info' title="编辑" onclick="edit('${var.gift_id }');"><i class='icon-edit'></i></a>
									</div>
								</td>
							</tr>
						</c:forEach>
						
						<!-- <tr>
							<td colspan="100" class="center">您无权查看</td>
						</tr> -->
					</c:when>
					<c:otherwise>
						<tr class="main_info">
							<td colspan="100" class="center" >没有相关数据</td>
						</tr>
					</c:otherwise>
				</c:choose>
				</tbody>
			</table>
			
			<div class="page-header position-relative">
				<table style="width:100%;">
					<tr>
						<td style="vertical-align:top;"><div class="pagination" style="float: right;padding-top: 0px;margin-top: 0px;">${page.pageStr}</div></td>
					</tr>
				</table>
			</div>
		</form>
	</div>
	<!-- PAGE CONTENT ENDS HERE -->
  </div><!--/row-->
	
</div><!--/#page-content-->
</div><!--/.fluid-container#main-container-->
		<!-- 返回顶部  -->
		<a href="#" id="btn-scroll-up" class="btn btn-small btn-inverse">
			<i class="icon-double-angle-up icon-only"></i>
		</a>
		
		<!-- 引入 -->
		<script type="text/javascript">window.jQuery || document.write("<script src='static/js/jquery-1.9.1.min.js'>\x3C/script>");</script>
		<script type="text/javascript" src="static/js/bootstrap.min.js"></script>
		<script type="text/javascript" src="static/js/ace-elements.min.js"></script>
		<script type="text/javascript" src="static/js/ace.min.js"></script>
		<script type="text/javascript" src="static/js/chosen.jquery.min.js"></script><!-- 单选框 -->
		<script type="text/javascript" src="static/js/bootstrap-datepicker.min.js"></script><!-- 日期框 -->
		<script type="text/javascript" src="static/js/bootbox.min.js"></script><!-- 确认窗口 -->
		<!-- 引入 -->
		
		<script type="text/javascript">
		$(top.hangge());
		
		//检索
		function search(){
			$("#productGiftForm").submit();
		}
		
		function view(gift_id){
			top.jzts();
			 var diag = new top.Dialog();
			 diag.Drag=true;
			 diag.Title ="查看";
			 diag.URL = '<%=basePath%>product/gift/goViewProductGift.do?gift_id='+gift_id;
			 diag.Width = 800;
			 diag.Height = 650;
			 diag.CancelEvent = function(){ //关闭事件
				 if(diag.innerFrame.contentWindow.document.getElementById('centerOfMainFrame').style.display == 'none'){
					 nextPage(${page.currentPage});
				}
				diag.close();
			 };
			 diag.show();
		}
		
		//修改
		function edit(gift_id){
			top.jzts();
			 var diag = new top.Dialog();
			 diag.Drag=true;
			 diag.Title ="编辑";
			 diag.URL = '<%=basePath%>product/gift/goEditProductGift.do?gift_id='+gift_id;
			 diag.Width = 800;
			 diag.Height = 650;
			 diag.CancelEvent = function(){ //关闭事件
				 if(diag.innerFrame.contentWindow.document.getElementById('centerOfMainFrame').style.display == 'none'){
					 nextPage(${page.currentPage});
				}
				diag.close();
			 };
			 diag.show();
		}
		
		function viewExchange(gift_id){
			 top.jzts();
			 var diag = new top.Dialog();
			 diag.Drag=true;
			 diag.Title ="兑换列表";
			 diag.URL = 'gift/exchange/listExchange.do?gift_id='+gift_id;
			 diag.Width = 900;
			 diag.Height = 600;
			 diag.CancelEvent = function(){ //关闭事件
				if(diag.innerFrame.contentWindow.document.getElementById('centerOfMainFrame').style.display == 'none'){
					nextPage(${page.currentPage});
				}
				diag.close();
			 };
			 diag.show();
		}
		
		function clearCondition(){
			$("#nav-search-input").val("");
			$("#nav-search-input2").val("");
			$("#lastStart").val("");
			$("#lastEnd").val("");
		}
		</script>
		<script type="text/javascript">
		$(function() {
			//单选框
			$(".chzn-select").chosen(); 
			$(".chzn-select-deselect").chosen({allow_single_deselect:true}); 
			//日期框
			$('.date-picker').datepicker();
		});
		</script>
	</body>
</html>

